import React, { useEffect } from 'react';
import { Space, Button, Form, Typography, Input } from 'antd';
const { Title } = Typography;
import { UserOutlined } from '@ant-design/icons';
import { Link } from 'react-router-dom';
import styles from './Register.module.scss';
export default function Login() {
    const [form] = Form.useForm();
    useEffect(() => {
        form.setFieldsValue({
            username: 'default username',
            password: '123456',
        });
    }, []);
    const onFinish = (values: any) => {
        console.log('Success:', values);
    };
    return (
        <div className={styles.container}>
            <div className={styles.title}>
                <Space>
                    <Title level={2}>
                        <UserOutlined style={{ fontSize: '30px' }} />
                    </Title>
                    <Title level={2}>登录</Title>
                </Space>
            </div>
            <div className={styles.form}>
                <Form onFinish={onFinish} layout="horizontal" form={form}>
                    <Form.Item
                        label="用户名"
                        name="username"
                        labelCol={{ span: 7 }}
                        wrapperCol={{ span: 18 }}
                        rules={[{ required: true, message: '请输入用户名' }]}
                    >
                        <Input />
                    </Form.Item>
                    <Form.Item
                        label="密码"
                        name="password"
                        labelCol={{ span: 7 }}
                        wrapperCol={{ span: 18 }}
                        rules={[{ required: true, message: '请输入密码' }]}
                    >
                        <Input.Password />
                    </Form.Item>
                    <Form.Item wrapperCol={{ offset: 7, span: 18 }}>
                        <Space>
                            <Button type="primary" htmlType="submit">
                                登录
                            </Button>
                            <Link to="/register">没有账号，去注册</Link>
                        </Space>
                    </Form.Item>
                </Form>
            </div>
        </div>
    );
}
